var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, a) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var a in t)
              Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
          })(t, a);
      };
      return function (t, a) {
        function i() {
          this.constructor = t;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        e(t, a),
          (t.prototype =
            null === a
              ? Object.create(a)
              : ((i.prototype = a.prototype), new i()));
      };
    })(),
  PackageView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.selectPackIndex = -1),
        (t.dataSource = []),
        (t.listArr = []),
        (t.isNeedPayee = !0),
        (t.packageDataLoadFn = {
          caller: t,
          code: 210,
          method: function (e) {
            t.freeWeightLable.text =
              "目前负重：" + e.weight + "/" + e.maxWeight;
          },
        }),
        (t.packageYaoPinBeiBaoFn = {
          caller: t,
          code: 1416,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].num),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "个" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageYaoPinCangKuFn = {
          caller: t,
          code: 1417,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].num),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "个" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageYaoZhuangBeiBeiBaoFn = {
          caller: t,
          code: 1423,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].level),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "级" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageYaoZhuangBeiCangKuFn = {
          caller: t,
          code: 1429,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].level),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "级" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageKuangShiBeiBaoFn = {
          caller: t,
          code: 1424,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].num),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "个" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageKuangShiCangKuFn = {
          caller: t,
          code: 1430,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].num),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "个" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageYaoZaWuBeiBaoFn = {
          caller: t,
          code: 1425,
          method: function (e) {
            (t.listArr = e.data), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.data.length; c++)
              (a = e.data[c].name),
                (i = e.data[c].num),
                (o = e.data[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "个" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.data[c].id,
                  name: a,
                  type: e.data[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        (t.packageYaoZaWuCangKuFn = {
          caller: t,
          code: 1431,
          method: function (e) {
            (t.listArr = e.list), (t.dataSource = []);
            for (var a, i, o, n, c = 0; c < e.list.length; c++)
              (a = e.list[c].name),
                (i = e.list[c].num),
                (o = e.list[c].id),
                (n = {
                  cangkuName: { text: a },
                  cangkuStore: { text: i + "个" },
                  btn_store_tiqu: { label: t.dealTabButtonLabel() },
                  packgoodID: o,
                  id: e.list[c].id,
                  name: a,
                  type: e.list[c].type,
                }),
                t.dataSource.push(n);
            t.list_package.array = t.dataSource;
          },
        }),
        t.btn_packageback.on(Laya.Event.CLICK, t, t.onPackageBackFn),
        (t.tab_storage.selectHandler = new Laya.Handler(
          t,
          t.onSelectedFunctionTabFn
        )),
        (t.tab_repository.selectHandler = new Laya.Handler(
          t,
          t.onSelectedRepositoryTabFn
        )),
        (t.list_package.selectEnable = !0),
        t.list_package.on(Laya.Event.CLICK, t, t.packageBeiBaoSelected),
        (t.list_package.vScrollBarSkin = ""),
        WebSocketService.addListener(t.packageDataLoadFn),
        WebSocketService.addListener(t.packageYaoPinBeiBaoFn),
        WebSocketService.addListener(t.packageYaoPinCangKuFn),
        WebSocketService.addListener(t.packageYaoZhuangBeiBeiBaoFn),
        WebSocketService.addListener(t.packageYaoZhuangBeiCangKuFn),
        WebSocketService.addListener(t.packageKuangShiBeiBaoFn),
        WebSocketService.addListener(t.packageKuangShiCangKuFn),
        WebSocketService.addListener(t.packageYaoZaWuBeiBaoFn),
        WebSocketService.addListener(t.packageYaoZaWuCangKuFn),
        WebSocketService.addListener({
          caller: t,
          code: 1476,
          method: t.onLoadMyLoadData,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.openPackageView = function (e) {
        return (
          null == this.packVC && (this.packVC = new t()),
          (this.packVC.isNeedPayee = e),
          this.packVC.initPack(),
          WebSocketService.send({ c: 1476 }),
          this.packVC
        );
      }),
      (t.prototype.onLoadMyLoadData = function (e) {
        0 == e.code &&
          (this.freeWeightLable.text =
            "目前负重：" + e.data[0] + "/" + e.data[1]);
      }),
      (t.prototype.initPack = function () {
        (this.selectPackIndex = 0),
          (this.tab_storage.selectedIndex = 0),
          (this.tab_repository.selectedIndex = 0),
          WebSocketService.send({ c: 210, d: { no: 2 } }),
          WebSocketService.send({ c: 1416, d: { pageNum: 0 } });
      }),
      (t.prototype.dealTabButtonLabel = function () {
        return 0 == this.tab_repository.selectedIndex ? "寄存" : "提取";
      }),
      (t.prototype.showPackageList = function () {
        for (var e, t = 0; t < this.dataSource.length; t++)
          (e = {
            cangkuName: { text: this.dataSource[t].name },
            cangkuStore: { text: this.dataSource[t].num + "个" },
            packStore: { text: void 0 },
            packgoodID: this.dataSource[t].gid,
            id: this.dataSource[t].id,
            name: this.dataSource[t].name,
            type: this.dataSource[t].type,
          }),
            this.dataSource.push(e);
        this.list_package.array = this.dataSource;
      }),
      (t.prototype.onSelectedFunctionTabFn = function (e) {
        (this.tab_repository.selectedIndex = 0),
          (this.dataSource = []),
          (this.list_package.array = []),
          this.setupPackageView(
            this.tab_storage.selectedIndex,
            this.tab_repository.selectedIndex
          );
      }),
      (t.prototype.onSelectedTabWuPinFn = function () {}),
      (t.prototype.onSelectedRepositoryTabFn = function () {
        this.setupPackageView(
          this.tab_storage.selectedIndex,
          this.tab_repository.selectedIndex
        );
      }),
      (t.prototype.setupPackageView = function (e, t) {
        (this.dataSource = []),
          0 == e && 0 == t
            ? WebSocketService.send({ c: 1416, d: { pageNum: 0 } })
            : 0 == e && 1 == t
            ? WebSocketService.send({ c: 1417, d: { pageNum: 0 } })
            : 1 == e && 0 == t
            ? WebSocketService.send({ c: 1423, d: { pageNum: 0 } })
            : 1 == e && 1 == t
            ? WebSocketService.send({ c: 1429, d: { pageNum: 0 } })
            : 2 == e && 0 == t
            ? WebSocketService.send({ c: 1424, d: { pageNum: 0 } })
            : 2 == e && 1 == t
            ? WebSocketService.send({ c: 1430, d: { pageNum: 0 } })
            : 3 == e && 0 == t
            ? WebSocketService.send({ c: 1425, d: { pageNum: 0 } })
            : 3 == e &&
              1 == t &&
              WebSocketService.send({ c: 1431, d: { pageNum: 0 } });
      }),
      (t.prototype.packageBeiBaoSelected = function (e) {
        if ((console.log(e.target.name), "" != e.target.name))
          if ("btn_store_tiqu" == e.target.name) {
            var t = this.listArr[this.list_package.selectedIndex],
              a = 1;
            2 == this.tab_storage.selectedIndex
              ? (a = 5)
              : 3 == this.tab_storage.selectedIndex
              ? (a = 4)
              : 1 == this.tab_storage.selectedIndex && (a = 3),
              0 == this.tab_repository.selectedIndex
                ? AXMaterialDialog.showMateralView(t, "背包", a)
                : AXMaterialDialog.showMateralView(t, "仓库", a);
          } else {
            var t = this.list_package.selectedItem,
              i = this.tab_storage.selectedIndex,
              o = void 0;
            0 == i
              ? (o = "药品")
              : 2 == i
              ? (o = "矿石")
              : 3 == i && (o = "杂物"),
              "药品" == o || "矿石" == o || "杂物" == o
                ? AXWearKuangShiDialog.showKuangShiDialog(t, o, "visiable_true")
                : AXSupplemnetArmyDialog.showSuppleArmyDialog(t, "guanyi");
          }
      }),
      (t.prototype.packageCangKuSelected = function (e) {
        if ("btn_store_tiqu" == e.target.name) {
          var t = 1;
          2 == this.tab_storage.selectedIndex
            ? (t = 5)
            : 3 == this.tab_storage.selectedIndex && (t = 4),
            0 == this.tab_repository.selectedIndex
              ? AXMaterialDialog.showMateralView(
                  this.listArr[this.list_package.selectedIndex],
                  "背包",
                  t
                )
              : AXMaterialDialog.showMateralView(
                  this.listArr[this.list_package.selectedIndex],
                  "仓库",
                  t
                );
        }
      }),
      (t.prototype.onPackageBackFn = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.PackageViewUI);
